import { instance as request } from "../utils/request";
export const addProduct = (data: any) => {
  return request({
    url: "/supplier/addProduct",
    method: "post",
    data,
  });
};
export const getProductList = ({ data, params }: { data: any; params: any }) => {
  return request({
    url: "/supplier/getProductList",
    method: "post",
    data,
    params,
  });
};

export const getProduct = (data: any) => {
  return request({
    url: "/supplier/getProduct",
    method: "post",
    data,
  });
};
export const delProduct = (data: any) => {
  return request({
    url: "/supplier/delProduct",
    method: "post",
    data,
  });
};
export const putProduct = (data: any) => {
  return request({
    url: "/supplier/putProduct",
    method: "post",
    data,
  });
};

export const getRandomCode = () => {
    return request({
      url: "/supplier/getSupRandomCode",
      method: "get",
    });
  };
export const addSupBill = (data: any) => {
    return request({
      url: "/supplier/addSupBill",
      method: "post",
      data,
    });
  };

  export const putSupBill = (data: any) => {
    return request({
      url: "/supplier/putSupBill",
      method: "post",
      data,
    });
  };
  export const getSupBillList = ({ data, params }: { data: any; params: any }) => {
    return request({
      url: "/supplier/getSupBillList",
      method: "post",
      params,
      data,
    });
  };

    export const getSupBill = (data: any) => {
    return request({
      url: "/supplier/getSupBill",
      method: "post",
      data,
    });
  };
  export const delSupBill = (data: any) => {
    return request({
      url: "/supplier/delSupBill",
      method: "post",
      data,
    });
  };
  
  export const dataExport = ({ data, params }: { data: any; params: any }) => {
    return request({
      url: "/supplier/exportData",
      method: "post",
      params,
      data,
      responseType: 'blob', // 设置响应类型为 blob
    });
  };
  export const getTotalAmount = ({ data, params }: { data: any; params: any }) => {
    return request({
      url: "/supplier/getTotalAmount",
      method: "post",
      params,
      data,
    });
  };
  
//   export const putBSupBill= (data: any) => {
//     return request({
//       url: "/putBill",
//       method: "post",
//       data,
//     });
//   };
  
//   export const getBillList = ({ data, params }: { data: any; params: any }) => {
//     return request({
//       url: "/getBillList",
//       method: "post",
//       params,
//       data,
//     });
//   };